<?php
require_once ("navigationview.php");
require_once ("Handler/UserHandler.php");

class RegisterView {

	private $users = "users";
	private $pass = "passw";
	private $passvalidate = "passvalidate";
	private $lastname = "lastname";
	/*----------------------------------------------*/

	private $remeberme = "remeber";
	private $CookieName = "Cookiename";
	private $Cookiepass = "Cookiepass";
	private $submit = "submit";
	private $string = "";

	public function NewUserBox() {

		//inloggning form-tagg...
		$NavigationView = new NavigationView();
		$UserHandler = new UserHandler();
		$RegisterController = new RegisterController();

		return "
			<div id='registration'>
		<h2>Registera dig</h2>
			<form name='login' id='RegisterUserForm' method='Post' action='" . $NavigationView -> GetRegisterIndex() . "'>
				<fieldset>
					<p>
						<label class='label' for='name'>Användarnamn(Förnamn):</label>
						</label><input type='text' size='20' name='$this->users' id='name' class='text' value='' />
					</p>
					<p>	
						<label class='label' for='name'>Efternamn:</label>
						<input type='text' size='20' name='$this->lastname' class='text' id='name' value='' />
					</p>
					<p>
						<label class='label' for='password'>Lösenord:</label>
						<input type='password' size='20' name='$this->pass' id='name' class='text' value='' />
					</p>
					<p>	
						<label class='label' for='password'>Lösenord(igen):</label>
						<input type='password' size='20' name='$this->passvalidate'class='text' id='name' value='' />
					</p>

					<input type='hidden' name='" . NavigationView::RegisterIndex . "' id='submithidden' value='true'/>
					<input type='submit' name='submit' id='submit' value='skapa ny användare'/>
			</fieldset>
			</form>
		</div>";

	}

	public function ChangeAction($string) {
		$NavigationView = new NavigationView();
		if ($string = true) {
			header("location:" . $NavigationView -> GetadressToIndex());
		} else {
			return $NavigationView -> GetRegisterIndex();
		}
	}

	public function GetUserName() {
		if (isset($_POST[$this -> users])) {

			return $_POST[$this -> users];

		}
	}

	public function GetLastName() {

		if (isset($_POST[$this -> lastname])) {
			
			return $_POST[$this -> lastname];

		}
	}

	
	
	
	public function GetPassword() {
		
		if (isset($_POST[$this -> pass])) {
			return $_POST[$this -> pass];

		}
	}

	public function GetSecondPassword() {
		if (isset($_POST[$this -> passvalidate])) {
			return $_POST[$this -> passvalidate];

		}
	}

	public function TriedTocreateNewUser() {
		if (isset($_POST["submit"])) {

			Return True;
		}
		return FALSE;

	}

	Public function NewMemberMessage() {

		$Stringer = "<p>Du har nu skapat dig ett konto hos Max's exclusiva webbplats!</p>";

		return $Stringer;
	}

	/// Felmeddelande
	Public function WrongUsernameMessage() {

		$Stringer = "<p>Du har ett felaktigt användarnamn</p>";

		return $Stringer;
	}

	Public function WrongPasswordMessage() {

		$Stringer = "<p>Du har ett felaktigt Lösenord</p>";

		return $Stringer;
	}

}
